package com.xiaoniu.mc.client.builder;

import com.xiaoniu.mc.client.context.ApplicationContext;
import com.xiaoniu.mc.client.producer.XmqProducer;
import org.apache.rocketmq.client.exception.MQClientException;

/**
 * @类描述：
 * @创建人：林继丰
 * @创建时间：2017/8/24 10:07
 * @版权：Copyright (c) 深圳市牛鼎丰科技有限公司-版权所有.
 */
public class XmqProducerFactory {

    private static final XmqProducerFactory xmqProducerFacotry = new XmqProducerFactory();

    public XmqProducer getProducer(String producerName) throws MQClientException {
        new XmqProducer().initProducer(producerName);
        return ApplicationContext.getInstanceNameMapProducer().get(producerName);
    }

    public static XmqProducerFactory getXmqProducerFacotry() {
        return xmqProducerFacotry;
    }
}
